Skip to content

Add native SponsorBlock integration#49

Draft
grohit1810 wants to merge 387 commits into
Tonwalter888:mainfrom
grohit1810:feature/add-sponsorblock
Draft

Add native SponsorBlock integration#49
grohit1810 wants to merge 387 commits into
Tonwalter888:mainfrom
grohit1810:feature/add-sponsorblock

Conversation

@grohit1810

Copy link
Copy Markdown

Summary

Adds built-in SponsorBlock support to YouMod, implementing all 9 segment categories with configurable per-category actions. This is a native implementation (not a bundled iSponsorBlock dylib), making it easier to maintain and extending support to include the Highlight (poi_highlight) category that iSponsorBlock lacks.

Resolves #34

Features

  • Full SponsorBlock API integration (sponsor.ajay.app)
  • 9 segment categories: Sponsor, Intro, Endcards, Interaction, Self-promotion, Non-music, Preview, Highlight, Filler
  • Per-category action modes: Disable, Auto-skip, Ask before skipping, Display on seek bar only, Skip-to (for Highlights)
  • Colored seek bar markers showing segment positions on the progress bar
  • Skip notification banner with Unskip button (auto-dismisses after configurable duration)
  • Ask mode with persistent Skip/Dismiss banner for manual-skip categories
  • Highlight support — skip TO the key moment (poi_highlight), not past it
  • Player overlay toggle button (shield icon) to enable/disable SponsorBlock per video
  • Full settings page with per-category controls and 12 color presets
  • Haptic feedback option on skip
  • In-memory segment caching per session (no redundant API calls)

Architecture

File Purpose
Files/SponsorBlock.x Core logic — API requests, segment model, skip engine
Files/SponsorBlockUI.x UI — notification banner, seek bar markers, overlay button
Files/SponsorBlockSettings.x Full settings page with per-category action/color pickers

@Tonwalter888

Copy link
Copy Markdown
Owner

Can you send me a screenshot about the skip banner? I want to see what it looks like.

@grohit1810

Copy link
Copy Markdown
Author

Here are screenshots and a screen capture video. Let me know if it looks good
image (2)
image (1)
image

ScreenRecording_05-02-2026.04-46-50_1.mp4

@Tonwalter888

Tonwalter888 commented May 2, 2026

Copy link
Copy Markdown
Owner

Can you trigger a skip dialog and send a screenshot here?
EDIT: The dialog that are asking you to skip or not.

@grohit1810

grohit1810 commented May 2, 2026

Copy link
Copy Markdown
Author

Note: This is a v1 implementation focused on getting all the core functionality working. Known limitations that I plan to address later(in a follow up PR):

  • Seek bar markers are currently rendered as a separate overlay above the progress bar. The next version will render them inline on the progress bar track itself (matching how YTLite does it).
  • Color picker currently uses 12 preset colors. A follow-up will add a full color picker with custom hex input.
  • Channel whitelisting (disable SponsorBlock for specific creators) is not yet implemented.

All core SponsorBlock functionality is complete and working — skipping, notifications, per-category settings, overlay toggle, and highlight support.

@grohit1810

Copy link
Copy Markdown
Author

Here is screenshot of skip dialog
image (3)

Settings Page:
image (4)

@Tonwalter888

Copy link
Copy Markdown
Owner

One more thing, can you do a long press on the miniplayer to see what happens?

@grohit1810

Copy link
Copy Markdown
Author

One more thing, can you do a long press on the miniplayer to see what happens?

Nothing happens on long press of the miniplayer. Video continues to play normally

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Nevermind, I tested it. The dialog is too small compares to YTLite. But a lot of things need to implement here.

  • Adds a skip dialog for highlight
  • Use built-in ColorPicker for segments colors
  • Make the segments height = YouTube's seekbar (Maybe you can use some codes from iSponsorBlock)

@grohit1810

grohit1810 commented May 2, 2026

Copy link
Copy Markdown
Author

@Tonwalter888 Updated the PR with all the requested changes

  • Skip dialog for highlight — shows a "Jump to highlight" banner when a highlight segment is available
  • Built-in ColorPicker — uses native iOS UIColorPicker for segment colors
  • Segment markers match YouTube's seekbar height — uses iSponsorBlock's approach with reference decoration views
  • Redesigned settings page — matches the UI of SponsorBlock settings page with YTLite SponsorBlock settings page

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Can you make the skip dialog like in YTLite?
IMG_3568

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Actually, can you use system UI settings (like this Sponsorblock) for all settings? YouTube’s settings are unstable and glichy.

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 For the system UI settings rewrite do you want that in this same PR, or should I open a separate one? It's a bigger change that touches the entire settings flow, so wanted to check.

Also just a heads up: I am writing and understanding the code myself (not fully AI generated), so my turnaround will be slower

@Tonwalter888

Copy link
Copy Markdown
Owner

@Tonwalter888 For the system UI settings rewrite do you want that in this same PR, or should I open a separate one? It's a bigger change that touches the entire settings flow, so wanted to check.

Also just a heads up: I am writing and understanding the code myself (not fully AI generated), so my turnaround will be slower

You can do on this PR. Just rewrite like the SponsorBlock you wrote, that's all I wanted. (Inside the sections)

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 Update the PR with both the changes

  • Skip dialog redesigned to match YTLite Style - Pill shaped pop up with progress depletion and fully interactable
  • Settings rewritten with system UIKit - same layout and sections as before.

@Tonwalter888

Copy link
Copy Markdown
Owner

@Tonwalter888 Update the PR with both the changes

  • Skip dialog redesigned to match YTLite Style - Pill shaped pop up with progress depletion and fully interactable

  • Settings rewritten with system UIKit - same layout and sections as before.

Will test this, thanks for implementing them.

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 I think there are some missing SponsorBlock segments.
And the dialog is hidden in fullscreen, I think you should move the dialog on top of the screen.
IMG_3591
IMG_3592
Also, can you use a slider for default tab bar? I implemented it before.
a512d99

@Tonwalter888

Copy link
Copy Markdown
Owner

Also adds a skip dialog for hightlight

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Also makes the button hidden with the overlay.
IMG_3599

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 I will add the new features in v1.4.0 in here.

@grohit1810

grohit1810 commented May 6, 2026

Copy link
Copy Markdown
Author

@Tonwalter888 I am not sure why you are not able to see the new pill shaped button in fullscreen mode?
I am able to see skip dialog to highlight and also in fullscreen.

I have the fix other two issues - Slider bar and hide sponsorblock button overlay
I will test it and push it

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Okey then.

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 Found the issue with full screen. I will fix this as well in my next commit

@Tonwalter888

Copy link
Copy Markdown
Owner

@Tonwalter888 Found the issue with full screen. I will fix this as well in my next commit

Alright, I will add more features after you pushed your fix.

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 The back button stays black in dark mode.
IMG_3606
IMG_3607

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 Fixed all three issues
image (1)
image

I will fix the back button stays not visible in dark mode in the next commit.
It's the OLED theme overriding nav bar tint color, should be a quick fix. I'll do it tomorrow

@Tonwalter888

Tonwalter888 commented May 7, 2026

Copy link
Copy Markdown
Owner

@grohit1810 Lastly, can you use the dialog for downloading? Replace the HUD toast with our dialog. (Replace the skip icon to a check and a cross (x) for errors)

@Tonwalter888

Tonwalter888 commented May 7, 2026

Copy link
Copy Markdown
Owner

@grohit1810
I think you should filp this icon to go back.
IMG_3613
And it looks like the skip dialog doesn’t apply the waiting time from the settings.
IMG_3614

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 I will fix all three issues - back button, not adhering to the wait times and the black back button
I will also add my dialog to the downloading toast

@NeonKokoro

Copy link
Copy Markdown

But we're not done yet with 2.0.0. We still have to move the download manager button and bug fixes, just to name a few.

@Tonwalter888

Copy link
Copy Markdown
Owner

But we're not done yet with 2.0.0. We still have to move the download manager button and bug fixes, just to name a few.

The download button is moved to the player overlay.

@NeonKokoro

Copy link
Copy Markdown

However one thing that bothers me about the SponsorBlock is the skip delay/cooldown after a segment has been skipped.

@MCTMS8

MCTMS8 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

However one thing that bothers me about the SponsorBlock is the skip delay/cooldown after a segment has been skipped.

I don't have that but when a segment is skipped especially a sponsor segment the video is not connected. Like one or two sec of the video are cut.

@Tonwalter888

Copy link
Copy Markdown
Owner

However one thing that bothers me about the SponsorBlock is the skip delay/cooldown after a segment has been skipped.

Will check this.

@Tonwalter888

Copy link
Copy Markdown
Owner

I don't have that but when a segment is skipped especially a sponsor segment the video is not connected. Like one or two sec of the video are cut.

Mine doesn't happen, tested with LTT videos.

@MCTMS8

MCTMS8 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

I don't have that but when a segment is skipped especially a sponsor segment the video is not connected. Like one or two sec of the video are cut.

Mine doesn't happen, tested with LTT videos.

Weird

@MCTMS8

MCTMS8 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

You should make pre-release so people can test new builds. I now that you can build the tweak yourself but mire simple to have pre-release.
@Tonwalter888

@NeonKokoro

Copy link
Copy Markdown

New beta crashes on startup with this issue:

-[YTInlineMutedPlaybackShortsPlayerOverlayViewController playerBarController]: unrecognized selector sent to instance 0x15a733200
Call stack: (
0 CoreFoundation 0x0000000196c4085c 40DA2EB3-721A-3272-8F24-66E7DAEBEB9A + 620636
1 YouTube 0x0000000111fd2eac YouTube + 40119980
2 YouTube 0x0000000111fd2380 YouTube + 40117120
3 libobjc.A.dylib 0x00000001969c0480 objc_exception_throw + 88
4 CoreFoundation 0x0000000196d390a4 40DA2EB3-721A-3272-8F24-66E7DAEBEB9A + 1638564
5 UIKitCore 0x000000019be88098 13630068-D3E5-3D17-A679-FEB7AF5BA3AE + 19341464
6 CoreFoundation 0x0000000196bfc94c 40DA2EB3-721A-3272-8F24-66E7DAEBEB9A + 342348
7 CoreFoundation 0x0000000196bfcc10 40DA2EB3-721A-3272-8F24-66E7DAEBEB9A + 343056
8 YouMod.dylib 0x0000000100a13958 SBColorFromHex + 42744
9 YouMod.dylib 0x0000000100a1411c SBColorFromHex + 44732
10 libdispatch.dylib 0x00000001c0e14ccc 27082A1E-6824-3F76-8CAB-6183F8BE7689 + 7372
11 libdispatch.dylib 0x00000001c0e2efa8 27082A1E-6824-3F76-8CAB-6183F8BE7689 + 114600
12 libdispatch.dylib 0x00000001c0e24344 27082A1E-6824-3F76-8CAB-6183F8BE7689 + 70468
13 libdispatch.dylib 0x00000001c0e24014 _dispatch_main_queue_callback_4CF + 44
14 CoreFoundation 0x0000000196bf2824 40DA2EB3-721A-3272-8F24-66E7DAEBEB9A + 301092
15 CoreFoundation 0x0000000196be38b8 40DA2EB3-721A-3272-8F24-66E7DAEBEB9A + 239800
16 CoreFoundation 0x0000000196be4820 40DA2EB3-721A-3272-8F24-66E7DAEBEB9A + 243744
17 GraphicsServices 0x000000023ad43f24 GSEventRunModal + 120
18 UIKitCore 0x000000019accf4d4 UIApplicationMain + 336
19 YouTube 0x0000000110004380 YouTube + 6767488
20 LiveContainerShared 0x000000010079fc9c invokeAppMain + 6528
21 LiveContainerShared 0x000000010079daa8 LiveContainerMain + 2348
22 dyld 0x0000000196a37608 089E4C28-B17C-3B3E-967E-F64B4A4ACF6A + 22024
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add iSponsorBlock as optional build setting

5 participants